import {v4 as uuidv4} from 'uuid'
//生成临时游客的uuid（随机字符串）,每个用户的uuid不能发生变化，还要持久存储
export const getUUID=()=>{
    //判断本地存储是否有uuid
    let uuid_token=localStorage.getItem('UUIDTOKEN')
    //没有
    if(!uuid_token){
        //生成uuid
        uuid_token=uuidv4()
        //存储本地
        localStorage.getItem('UUIDTOKEN',uuid_token)
    }
    //当用户有uuid不在生成
    return uuid_token
}